require(['config'], () => {
  require(['jquery'], ($) => {
    class newLogin {
      constructor() {
        this.scan()
        this.zhangh()
        this.shaoma()
        this.dengl()
      }
      scan () {
        $('.ewm').mouseenter(function () {
          $('.kuang').css("right", "100px");
          $('.sj').css('display', 'block');
          $('.sj').css('opacity', '1');
        })
        $('.ewm').mouseleave(function () {
          $('.kuang').css("right", "0");
          $('.sj').css('display', 'none');
          $('.sj').css('opacity', '0');
        })

      }
      zhangh () {
        $('.deng').on('click', '.zhangh p', function () {
          $('.zhangh p').css('color', '#f10180');
          $('.shaom p').css('color', '#666666');
          $('.qd').css('display', 'none');
          $('.bxin').css('display', 'block');
        })
      }
      shaoma () {
        $('.deng').on('click', '.shaom p', function () {
          $('.zhangh p').css('color', '#666666');
          $('.shaom p').css('color', '#f10180');
          $('.qd').css('display', 'block');
          $('.bxin').css('display', 'none');
        })
      }
      dengl () {
        $('.btn').on('click', () => {
          const _username = $('.username').val(), _password = $('.password').val()
          $.ajax({
            url: 'http://localhost:3300/login.do',
            method: 'POST',
            data: {
              username: _username,
              password: _password
            },
            success: resData => {
              console.log('成功', resData)
              const { status, message } = resData.data
              if (resData.data.status === 200) {
                location.href = 'index.html'
                localStorage.setItem('nickname', resData.data.userInfo.nickname)
                console.log(resData.data.userInfo.nickname)
              } else {
                alert(message)
              }
            }
          })
        })
      }
    }

    new newLogin()
  })
})